import { Column, Entity, Index } from "typeorm";
import { DeletedEntity } from "./base/deleted.entity";

@Index("sys_dict_item_pkey", ["id"], { unique: true })
@Index("sys_dict_item_type_id_value_not_deleted_ukey", ["typeId", "value"], {
    unique: true,
})
@Entity("sys_dict_item", { schema: "public" })
export class SysDictItem extends DeletedEntity {
    @Column("bigint", { primary: true, name: "id" })
    id!: string;

    @Column("bigint", { name: "type_id" })
    typeId!: string;

    @Column("character varying", { name: "type_code", length: 64 })
    typeCode!: string;

    @Column("character varying", { name: "name", length: 128 })
    name!: string;

    @Column("character varying", { name: "value", length: 256 })
    value!: string;

    @Column("boolean", { name: "status", default: () => "true" })
    status!: boolean;

    @Column("boolean", { name: "default", default: () => "false" })
    default!: boolean;

    @Column("integer", { name: "rank", nullable: true })
    rank!: number | null;

    @Column("character varying", { name: "remark", nullable: true, length: 256 })
    remark!: string | null;
}
